/*
 * 29.10.2009 New package structure
 * 22.10.2006 isAssignOp(), isAddOp(), isMulOp()
 * 28.09.2006 New keyword: return
 * 22.09.2006 Keyword recoqnition in constructor
 * 22.09.2006 ERROR added
 * 17.09.2006 Original Version (based on Example 4.2 in Watt&Brown)
 */
 



public class Token
{
	public byte kind;
	public String spelling;
	
	
	public Token( byte kind, String spelling )
	{
		this.kind = kind;
		this.spelling = spelling;
		
		if( kind == IDENTIFIER )
			for( byte i = 0; i < SPELLINGS.length; ++i )
				if( spelling.equals( SPELLINGS[i] ) ) {
					this.kind = i;
					break;
				}
	}
	
	
	
	
	

	
	

	public static final byte ARRAYOF = 0;
	public static final byte AT = 1;
	public static final byte BEGIN = 2;
	public static final byte DO = 3;
	public static final byte ELSE = 4;
	public static final byte ENDFUNCTION = 5;
	public static final byte ENDIF = 6;
	public static final byte ENDWHILE = 7;
	public static final byte EOL = 8;
	public static final byte FUNCTION = 9;
	public static final byte IF = 10;
	public static final byte KINDOF = 11;
	public static final byte LET = 12;
	public static final byte MAIN = 13;
	public static final byte READ = 14;
	public static final byte SIZEOF = 15;
	public static final byte WHILE = 16;
	public static final byte WITHPARAMS = 17;
	public static final byte WRITE = 18;
	public static final byte PLUS = 19;
	public static final byte MINUS = 20;
	public static final byte MUL = 21;
	public static final byte DIV = 22;
	public static final byte MOD = 23;
	public static final byte LESS = 24;
	public static final byte MORE = 25;
	public static final byte EQUAL = 26;
	public static final byte LESSEQ = 27;
	public static final byte MOREEQ = 28;
	public static final byte BE = 29;
	public static final byte OR = 30;
	public static final byte AND = 31;
	public static final byte NOT = 32;
	public static final byte ERROR = 33;

	public static final byte IDENTIFIER = 34;
	public static final byte INTEGERLITERAL = 35;

	
	public static final byte EOT = 36;

	
	
	
	private static final String SPELLINGS[] =
	{
		"ARRAYOF",
		"AT",
		"BEGIN",
		"DO",
		"ELSE",
		"ENDFUNCTION",
		"ENDIF",
		"ENDWHILE",
		"EOL",
		"FUNCTION",
		"IF",
		"KINDOF",
		"LET",
		"MAIN",
		"READ",
		"SIZEOF",
		"WHILE",
		"WITHPARAMS",
		"WRITE",
		"PLUS",
		"MINUS",
		"MUL",
		"DIV",
		"MOD",
		"LESS",
		"MORE",
		"EQUAL",
		"LESSEQ",
		"MOREEQ",
		"BE",
		"OR",
		"AND",
		"NOT",
		"ERROR",
		"IDENTIFIER",
		"INTEGERLITERAL",
		
		"EOT"

	};
	
	
}